<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<ul class="nav nav-tabs">
    <li role="presentation" class="active"><a href="#">Home</a></li>
    {% for type in types %}
        <li role="presentation"><a href="/list?tid={{ type.id }}">{{ type.name }}</a></li>
    {% endfor %}
</ul>

<form method="get" action="/list">
    <input type="text" name="kw" placeholder="关键字">
    <input type="submit" value="提交" >
</form>

<div class="row">
    {% for good in goods.object_list %}
        <div class="col-sm-6 col-md-4">
            <div class="thumbnail">
                <img src="/static/images/{{ good.picname }}" alt="..." style="width: 100px; height: 80px">
                <div class="caption">
                    <h3>商品名称：{{ good.goods }}</h3>
                    <p>{{ good.content }}</p>
                    <p><a href="/detail/{{ good.id }}" class="btn btn-primary" role="button">详情页</a> <a href="/cart/add/{{ good.id }}"
                                                                                                        class="btn btn-default"
                                                                                                        role="button">加入购物车</a>
                    </p>
                </div>
            </div>
        </div>
    {% endfor %}
</div>


<nav aria-label="Page navigation">
    <ul class="pagination">
        <li>
            {% if goods.has_previous %}
                <a href="/list/{{ goods.previous_page_number }}" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            {% else %}
                <a class="disabled" href="#" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            {% endif %}
        </li>
        {% for page in paginator.page_range %}
            <li><a href="/list/{{ page }}">{{ page }}</a></li>
        {% endfor %}
        <li>
            {% if goods.has_next %}
                <a href="/list/{{ goods.next_page_number }}" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            {% else %}
                <a class="disabled"  href="#" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            {% endif %}
        </li>
    </ul>
</nav>

<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
</body>
</html>